import axios from 'poros/http';

// const BASE_API = 'http://10.110.96.81:8030';
const BASE_API = '';

// 保存线索接口
export const postClueSave = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsBizSnapshoot/save`,
    method: 'post',
    data,
  });
// 获取流程ID
export const postClueCreate = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/process/createOrUpdate`,
    method: 'post',
    data,
  });
// 提交线索接口
export const postClueSubmit = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsBizSnapshoot/submit`,
    method: 'post',
    data,
  });
// 获取线索列表
export const postClueList = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsBizSnapshoot/listByPage`,
    method: 'post',
    data,
  });
// 获取线索详情
export const getClueDetails = leadsNo =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsBizSnapshoot/getLeadsCreate/${leadsNo}`,
    method: 'get',
  });
// 删除线索
export const postDeleteClue = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsBizSnapshoot/delete`,
    method: 'post',
    data,
  });
// 撤回接口
export const getRecallClue = id =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsBizSnapshoot/recall/${id}`,
    method: 'get',
  });
// 查询流程节点
export const getProcessNode = (processId, code) =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/processNode/getSingleNodeApprovalProcess/${processId}/${code}`,
    method: 'get',
  });
// 转他人处理
export const getOthersHandingList = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsBizSnapshoot/forward`,
    method: 'post',
    data,
  });
// 操作日志
export const getOperationLog = (type, id) =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/log/query/${type}/${id}`,
    method: 'get',
  });
// 审核线索
export const postClueAudit = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsBizSnapshoot/auditLeadsCreate`,
    method: 'post',
    data,
  });
// 上传附件
export const postUploadFile = (type, id, file) => {
  const formData = new FormData();
  formData.append('file', file);
  return axios({
    url: `${BASE_API}/api/salesforecast-service/attachment/upload/${type}/${id}`,
    headers: { 'Content-Type': 'multipart/form-data' },
    method: 'post',
    data: formData,
  });
};
// 查询线索跟进列表
export const postleadsFollowList = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leads/listByPage`,
    method: 'post',
    data,
  });
// 线索跟进保存
export const postleadsUpdate = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leads/update`,
    method: 'post',
    data,
  });
// 查询线索跟进详情
export const getClueFollowDetails = leadsNo =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leads/getLeadsByNo/${leadsNo}`,
    method: 'get',
  });
// 线索转派
export const postleadstransfer = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsBizSnapshoot/transfer`,
    method: 'post',
    data,
  });
// 转商机审批
export const postleadstransBiz = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsBizSnapshoot/transBiz`,
    method: 'post',
    data,
  });
// 线索失销
export const postleadsLose = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leads/lose`,
    method: 'post',
    data,
  });
// 细类，类别
export const postloseReasonCfg = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/loseReasonCfg/list`,
    method: 'post',
    data,
  });
// 查询产品分页接口
export const postProductList = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/product/listByPage`,
    method: 'post',
    data,
  });
// 关联产品接口
export const postleadsProduct = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsProduct/batchInsert`,
    method: 'post',
    data,
  });
// 查询关联产品
export const postleadsProductList = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsProduct/list`,
    method: 'post',
    data,
  });
// 删除关联产品
export const postleadsProductDelete = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsProduct/delete`,
    method: 'post',
    data,
  });
// 查询联系人分页接口
export const postContactList = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/contact/listByPage`,
    method: 'post',
    data,
  });
// 关联联系人
export const postleadsContact = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsContact/batchInsert`,
    method: 'post',
    data,
  });
// 查询线索联系人
export const postleadsContactList = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsContact/list`,
    method: 'post',
    data,
  });
// 删除关联联系人
export const postleadsContactDelete = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsContact/delete`,
    method: 'post',
    data,
  });
// 查询拜访列表
export const postleadsVisit = (no, type) =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/visit/findOppOrLeads?no=${no}&type=${type}`,
    method: 'post',
  });
// 删除拜访
export const postleadsVisitDelete = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsVisit/delete`,
    method: 'post',
    data,
  });
// 关联销售团队
export const postleadsSalesTeam = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsSalesTeam/batchInsert`,
    method: 'post',
    data,
  });
// 查询销售团队
export const postleadsSalesList = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsSalesTeam/list`,
    method: 'post',
    data,
  });
// 删除关联销售团队
export const postleadsSalesDelete = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsSalesTeam/delete`,
    method: 'post',
    data,
  });

// 附件列表查询
export const postEnclosureList = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/attachment/list`,
    method: 'post',
    data,
  });

// 删除线索附件
export const postAttachmentDelete = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/attachment/delete`,
    method: 'post',
    data,
  });
// 获取销售团队
export const getleadsSalesTeam = params =>
  axios({
    url: '/api/poros-permission/secStaff/list',
    method: 'get',
    params,
  });
// 导出线索
export const postleadsBizSnapshoot = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leads/export`,
    method: 'post',
    responseType: 'arraybuffer',
    hasInterceptors: true,
    data,
  });
// 线索转派详情
export const getLeadsTransferDetail = auditNo =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsBizSnapshoot/getLeadsTransfer/${auditNo}`,
  });
// 线索转商机详情
export const getLeadsTransferBizDetail = auditNo =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsBizSnapshoot/getLeadsTransferBiz/${auditNo}`,
  });
// 线索转派审核
export const postAuditLeadsTransfer = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsBizSnapshoot/auditLeadsTransfer`,
    method: 'post',
    data,
  });
// 线索转商机审核
export const postAuditLeadsTransferBiz = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/leadsBizSnapshoot/auditLeadsTransferBiz`,
    method: 'post',
    data,
  });
//获取客户弹框list
export const postCustomerList = data =>
  axios({
    url: `${BASE_API}/api/salesforecast-service/visit/findContact?name=${data.cname}`,
    method: 'post',
    data,
  });
